1. Technology Field
The present invention generally relates to a flash memory writing method, and more particularly, to a flash memory writing method which can write data through different writing processes according to a usage pattern of each logical block in a flash memory and a flash memory storage system and a flash memory controller using the same.
2. Description of Related Art
Along with the widespread of digital cameras, cell phones, and MP3 in recently years, the consumers' demand to storage media for storing digital contents has increased drastically. Flash memory is one of the most adaptable storage media to be carried around and used for storing digital files due to its characteristics such as data non-volatility, low power consumption, small volume, and non-mechanical structure.
Conventionally, a flash memory storage device is mainly used for storing user data. For example, a user may use a flash drive for storing digital files or use a memory card as the storage medium of a portable device, such as a digital camera or a MP3 player. Such a flash memory storage device is usually used for storing digital data of large quantity (for example, data above 64 Kb or 128 Kb). Along with the development of flash memory technology, the storage capacity of flash memory storage devices has increased while the cost thereof has decreased. Thus, many computer manufacturers start to use solid state drive (SSD, which has a flash memory as its storage medium) as the primary disk in computer systems.
Based on the physical characteristics of flash memory, the memory cells in a flash memory can only be programmed in a single direction (i.e., each bit in a memory cell can only be programmed from “1” to “0”). Thus, before writing a new data into a memory cell of a flash memory, the data previously stored in the memory cell has to be erased first.
Regarding the design of a flash memory storage system, physical blocks in the flash memory storage system are usually grouped into a plurality of physical units. Each physical unit has at least one flash memory cell, wherein the flash memory cell is composed of at least one transistor (such as a metal oxide semiconductor field effect transistor (MOSFET) or other logic circuit) and stores at least one bit. These physical units are grouped into a data area and a spare area. Physical units in the data area store valid data written by write commands, and physical units in the spare area are used for substituting the physical units in the data area when the write commands are executed. To be specific, when a flash memory storage system receives a write command from a host and is desired to write new data into a physical unit to be updated in the data area, the flash memory storage system selects a physical unit from the spare area and writes both the valid old data copied from the physical unit to be updated in the data area and the new data into the physical unit selected from the spare area. Then, the flash memory storage system links the physical unit containing the new data to the data area and erases the physical unit ro be updated and links it to the spare area. In order to allow the host to successfully access the physical units which are alternatively used for storing data, the flash memory storage system provides logical units to the host. Namely, the flash memory storage system reflects the alternation of the physical units by recording and updating mapping relationships between the logical units and the physical units in the data area in a logical address-physical address mapping table. Thereby, the host simply writes data into a provided logical unit while the flash memory storage system accesses the corresponding physical unit according to the logical address-physical address mapping table.
Based on the operation mechanism of flash memory storage system described above, when a flash memory storage system is used as a primary hard disk of a computer system, because the computer system frequently writes and updates data in small quantities (for example, data less than 4 Kb or 8 Kb), erasing operations will be frequently performed to the physical units in the flash memory storage system in order to write data alternatively into the physical units. However, the physical blocks for forming a physical unit can only be erased for a limited number of times (for example, 10,000 times at most). Thus, the lifespan of a flash memory storage device will be greatly shortened by frequently erasing the physical units thereof.